and the Macnexus Macintosh User Group of Sacramento.
This archive provides two example 'IEnd' code resources. Each can be used with Aladdin's InstallerMaker program, to prompt a new Internet user to enter the name of their PPP account and their password, in order to save those settings into their PPP Preferences file. This works in the context of an Installer which installs all of the needed software for Internet/Web access, including FreePPP or MacPPP and a pre-configured PPP Preferences file, set up properly for accessing that service. Be sure that the PPP Preferences file you use is created by the same extension included in your archive. Current versions of FreePPP create a preferences file which is not compatible with MacPPP. This code is unaffected by those changes, however.
This archive inludes:
• Two 'IEnd' resource files:
PPP_PrefSaver 1.1-IEnd.rsrc - Include this resource file with your Installer to save the account name and password settings into the current server's connect script.
PPP_PrefSaver(A) 1.1-IEnd.rsrc - Located in the "Authentication PrefSaver" folder, use this resource file to save the account name and password directly into the current server's Authentication settings.
• A standalone version of the code, which saves the account name and password into the active server's connect script. Note: If you run the standalone application, enter settings and confirm them without cancelling, that program will write those settings into the active server's connect script -- SO BE FOREWARNED!
• A demo Installer, created with InstallerMaker 2.0.2 Demo.
The demo Installer will install a generic useless file named "Blue" on your desktop. It will NOT actually save anything into the PPP Preferences. It is only a demo.
• The source code used to generate the program.
The project is set to compile as a standalone application which saves the account name and password into the active server's connect script. A PPP connect script allows you to use up to 8 (numbered 0 - 7) fields, the default used in this code is to place the account name in field 1 and the password in field 3.
The program was created with THINK C 7.x. and the Universal Headers.
Added in 1.1: Now you can save the account name and password right into the Authentication settings, if desired, instead of in the connect script. It turns out that even though FreePPP scrambles the password, when entered via FreePPP Setup, if the password is written into the correct field of the preferences file without encryption, FreePPP has no problems reading it un-encrypted.
Fixed in 1.1: SimpleModalFilter() was fixed to correctly prevent users from entering illegal characters. Added check to make sure OK button is actually enabled before changing a carriage return into a hit on the OK button.
Fixed in 1.0.1: The Confirm settings dialog now grabs the correct text for the user settings. The dialog item numbers were incorrect, previously, and led the program to pull out the wrong strings.
Changed in 1.0.1: The guidelines listed in the InstallerMaker user guide, for version 3.0, instruct that all standard Macintosh resources included with the 'IEnd' code resource should have ID's in the range from 3000 - 7999. Appropriate adjustments were made to the 'DLOG', 'DITL' and 'ALRT' resources to meet this specification, while remaining compatible with the 2.x series of InstallerMaker.
System Requirements: NetSurfer PPP_PrefSaver uses System 7 dialog/alert auto-centering. If you need to create an installer for System 6 users, you can turn off auto-centering and place the dialog and alerts so their top, left corners are at 100,100. That should be suitable for most monitors. You could add code to handle centering, if you like, but since this isn't something a user will be repeatedly using, I personally don't think it's worth putting in the extra code. The appearance will be little noticed.
To compile as a code resource of type 'IEnd', with ResEdit's Creator code 'RSED' and the ResEdit file type 'rsrc', select "Set Project Type..." from the Project menu in the THINK Project Manager when the project is open, and set the fields to those as pictured below:
The only attribute set is "Purgeable". If you change the settings to compile the code so as to write into the active server's Authentication settings, instead of in the connect script, I suggest naming the 'IEnd' resource: PPP_PrefSaver(A), to differentiate it.
If you have upgraded to InstallerMaker 3.0, you should set the ID to 256.
To return to compiling as a standalone app: Set the project type to application, give it 100K for a partition, set the 32bit compatible flag, and open the PPP_Pref.h file and change #define STANDALONE 0 to #define STANDALONE 1.
About the code:
If the PPP Preferences file is not found, or if the abort parameter is set by the Installer, the code does nothing.
It expects the Installer to have installed the pre-configured PPP Preferences file, so that it can finish the job by filling in the user's account name and password.
The code limits the user to 8 lowercase alphabetic and/or numeric characters for the account name and likewise for the password. If the user enters uppercase letters, they are converted to lowercase. No sense endlessly beeping at a user with CAPS LOCK on.
Once the OK button is pressed, the user is asked to confirm the settings entered. If needed the user can then cancel and go back to entering the settings again.
Other directives:
If you compile with #define USE_SCRIPT 1: (This is the default)
If the user confirms the settings, the account name and password are written into the connect script for the currently active server selection, in the PPP Preferences file. There are 8 fields that text may be placed into in the connect script. There are two other settings that allow you to choose which of the fields in the connect script the account name and password are written to: NAME_COMMAND and PWORD_COMMAND.
The default settings in the code are:
#define NAME_COMMAND 1
#define PWORD_COMMAND 3
If you compile with #define USE_SCRIPT 0:
If the user confirms the settings, the account name and password are written into the Authentication settings for the active server selection, in the PPP Preferences file.
If you compile with #define DEMO_ONLY 1:
The code will be compiled so that nothing is actually saved into the preferences file.
Final Comments:
The source code is pretty easy to follow. There are some helpful comments included along the way. See the InstallerMaker manual for specific information about including a custom 'IEnd' procedure in your Installer. (Not much to it, actually. Just click the mini ResEdit icon in the lower left-hand corner or the Installer archive window, then find and select the resource file you want to include.) Note: This code does nothing to evaluate the abort parameter for purposes of recovering from an abort, it just returns what it is sent.
Rights To The Program:
This program is free for anyone to use, commercial or otherwise, no need to seek permission, providing: You send a letter to Aladdin and tell them of your appreciation of the availability of this source code, and how it has increased your satisfaction with InstallerMaker. Please credit me, Eric Long, as the author. (-:
You will want to edit various elements of the text, which are specific to Macnexus, like the term "NetSurfer", to fit your needs. Note that the Copland style folder icon shown has the Macnexus trademarked logo on it. You should replace that icon with one of your own to avoid copyright infringement.
Addition of icons and other editing of the dialog appearance by Willie Raye.
Willie also contributed to this project various elements of documentation I needed and helped test to make sure things were running smoothly. Willie is the creator of the Installer Macnexus uses, which this code was added to.